package CTCOffice;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;

import TrackModel.StationBlock;

/**
 * Scheduler is a class designed to create a schedule for a given train. The alogrithm used will take
 * into account to following factors:
 *		*Current Trains Route
 * 		*All Existing Train Schedules
 *		*FUTURE: Re-routing to attempt schedule optimizations
 * All schedules are internal to the class and 
 * @author Mike Hearing
 */
public class Scheduler {
	private HashMap<Integer, Schedule> schedules;

	/**
	 * Default constructor initializes all variables and prepares the scheduler to be able to run.
	 * 
	 * @see Schedule
	 */
	public Scheduler() {
		schedules = new HashMap<Integer, Schedule>();
	}
	
	public Schedule getSchedule(int tid) {
		return schedules.get(tid);
	}
	
	public ArrayList<Schedule> getSchedules() {
		ArrayList<Schedule> results = new ArrayList<Schedule>();
		for(Schedule s: schedules.values())
			results.add(s);
			
		return results;
	}
	
	public void addScheudle(int tid, ArrayList<StationBlock> route, String aTime) {
		schedules.put(tid, new Schedule(tid, route, aTime));
	}
	
	public void update() {
		
	}
}